require "./EmpAdd.css"
{SysAdd} = require "./SysAdd"

exports["@EmpAdd"] = {comment:"员工增加"}
exports.EmpAdd = new Class
  Extends: SysAdd
  options:
    enyStr: "Emp"
    headArr: ["code","password","name","sex","addr","wtel","htel","mtel","birthdate","origin","com_addr","zip","card","nation","religiou","edu_lvl","school","politic","occup","job","position","interest","skill","marital","health","fax","email","qq","msn","person","introduction","picture","enable"]
    $vdts: ["code","password"]
    headObj:
      "code":"编码"
      "password":"密码"
      "name":"姓名"
      "sex":"性别"
      "addr":"家庭地址"
      "wtel":"办公电话"
      "htel":"家庭电话"
      "mtel":"移动电话"
      "birthdate":"出生日期"
      "origin":"籍贯"
      "com_addr":"通信地址"
      "zip":"邮编"
      "card":"身份证号"
      "nation":"民族"
      "religiou":"宗教信仰"
      "edu_lvl":"教育程度"
      "school":"毕业学校"
      "politic":"政治面貌"
      "occup":"职业类型"
      "job":"职务"
      "position":"职位"
      "interest":"爱好"
      "skill":"特长"
      "marital":"婚姻状况"
      "health":"健康状况"
      "fax":"传真"
      "email":"邮箱"
      "qq":"QQ"
      "msn":"MSN"
      "person":"性格描述"
      "introduction":"个人简述"
      "picture":"照片"
      "enable":"启用"
  "@codeVdt":{comment:"编码code验证方法,执行runAllVdts时会调用此方法"}
  codeVdt: (key,val,id)->
    t = this
    o = t.options
    if val.trim() is ""
      return {err:"编码不能为空!",time:2}
    rltSet = yield o.thisSrv.ajax "codeVdt",[key,val,id]
    rltSet
  passwordVdt: (key,val,id)->
    t = this
    o = t.options
    valTrim = val.trim()
    if valTrim is ""
      return {err:"密码不能为空!",time:2}
    if valTrim.length > 12 or valTrim.length < 6
      return {err:"密码必须在6至12个字符之间!",time:2}
    true
